package com.wangxiaotao.springcloud.service;

import com.wangxiaotao.springcloud.entities.CommonResult;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;

/**
 * Feign配置 在接口上使用@FeignClient注解 value：服务名称
 *  接口+@FeignClient注解 替代restTemplate
 *   接近于：controller调用service层
 * @author Wangxiaotao
 * @create 2021-09-08-23:22
 */
@Component
@FeignClient(value = "cloud-payment-service")//所调用的服务名称
public interface PaymentFeignService {

    /**
     * 所调用微服务接口的controller处理器的方法
     * @param id
     * @return
     */
    @GetMapping(value = "/payment/get/{id}")
    public CommonResult getPaymentById(@PathVariable("id") Long id);

    @GetMapping(value = "/payment/feign/timeout")
    public String payemntFeignTimeOut();
}
